<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>做表单验证-实验三</title>
		<script src="jquery.min.js"></script>
		<script src="bootstrap.min.js"></script>
		<link rel="stylesheet" href="../css/bootstrap.min.css">
		<script type="text/javascript">
			function checksid(){
				sidvalue=$("#studentid").val();
				regExp=/^[0-9]{9}$/;
				if(!regExp.test(sidvalue)){
					$("#studentid").css("border","1px solid red");
					return false;
				}else{
					$("#studentid").css("border","");
					return true;
				}
			}
			function checkSname(){
				sname=$("#sname").val();
				regExp=/^[\u4E00-\u9FA5]{2,4,}$/;
				if(!regExp.test(sname)){
					    $("#sname").css("border","1px solid red");
						return false;
					}else{
						$("#sname").css("border","");
						return true;}
				}
				function checkAll(){
					flag1=checksid();
					flag2=checkSname();
					return flag1 && flag2;
					}
					
		</script>
	</head>
	<body>
		学号<input onblur="checksid()" class="form-control" type="text" id="studentid"><br>
		姓名<input onblur="checkSname()" class="form-control" type="text" id="sname"><br>
		<button onclick="checkAll()" class="btn btn-danger btn-block">注册</button>
	</body>
</html>
